<template>
	<div>
		<el-table
		    :data="tableData"
		    style="width: 100%"
			height="500"
		    >
		    <el-table-column
		      prop="name"
		      label="项目名">
		    </el-table-column>
		    <el-table-column
		      prop="leader"
		      label="负责人"
		      >
		    </el-table-column>
        <el-table-column
          prop = "createTime"
          label = "立项时间"
          sortable
          >
        </el-table-column>
		    <el-table-column
		      prop="state"
		      label="项目状态"
		      >
		    </el-table-column>
      <!--			      fixed="right"-->
			<el-table-column
			      label="操作"
			      >
			      <template slot-scope="scope">
			        <el-button @click="Info(scope.row.id)" type="text" size="small">查看详情</el-button>
			        <!-- <el-button type="text" size="small" @click="MoneyApp(scope.row.id)">资金申请</el-button> -->
			      </template>
			    </el-table-column>
		  </el-table>
	</div>
</template>

<script>
  import Convert from '../assets/js/Convert'
	export default {
		name:"projects",
		data() {
		  return {
        tableData: []
		  }
		},
		methods:{
        MoneyApp(id){
				this.$router.push({
					path:"/MoneyApply?id=" + id
				})
			},
      Info(id){
			    console.log(id)
          this.$router.push({
              path:"/project?project_id=" + id
          })
      }
		},
		components:{

		},
    mounted() {
		    // console.log(this.$store.getters.getCollegeId)
		    let _this = this
		    this.$post({
            url : "/project/college/list",
            data:{
                collegeId : _this.$store.getters.getCollegeId
            }
        }).then(res =>{
            res.forEach((item,index) =>{
                item.state = Convert.ProjectState(item.state)
            })
            this.tableData = res
        }).catch(err => {
            console.log(err)
        })
    }
  }
</script>

<style scoped>

</style>
